from library_test.base_test import BaseTest

class AnsibleModuleMocker:
    def __init__(self, params: dict):
        self.params = params

    def fail_json(self, msg, changed=True, rc=1):
        pass


class BaseTestMindieConfig(BaseTest):

    @classmethod
    def get_module_path(cls):
        return "ascend_deployer.module_utils.deepseek_pd.mindie_config"

    @classmethod
    def setUpClass(cls) -> None:
        super().setUpClass()
        from ascend_deployer.module_utils.deepseek_pd.mindie_config import MindiePDConfig
        param = {
            "p_instances_num": 1,
            "d_instances_num": 1,
            "single_p_instance_pod_num": 1,
            "single_d_instance_pod_num": 1,
            "weight_mount_path": "",
            "expert_map_file": "",
            "model_name": "",
            "model_weight_path": "",
            "npu_info": {"scene":"a910_93"},
            "job_id": "",
            "max_seq_len": "",
            "mindie_host_log_path": "",
            "tls_config": {},
        }
        cls.mindie_pd_config = MindiePDConfig(AnsibleModuleMocker(param), "")


class TestMindiePDConfig(BaseTestMindieConfig):

    def test_modify_deploy_config(self):
        self.mindie_pd_config.data = {}
        self.mindie_pd_config.modify_deploy_config()
        self.mindie_pd_config.data = {"deploy_config": {}}
        self.mindie_pd_config.modify_deploy_config()
        self.assertEqual(self.mindie_pd_config.data["deploy_config"]["p_instances_num"], 1)